<?php

declare(strict_types=1);

namespace App\Request\User;

use App\Request\BaseCommonRequest;
use Hyperf\Context\Context;
use Hyperf\Validation\Request\FormRequest;

class SetBlacklistRequest extends BaseCommonRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'type' => 'required|in:1,2',
            'black_uid' => 'required',
        ];
    }

    public function messages(): array
    {
        $language = Context::get('language');
        if ($language == 'zh-zn') {
            return [
                'type.required' => '操作不能为空',
                'type.in' => '操作只能为:1,2',
                'black_uid.required' => '用户ID不能为空',

            ];
        } elseif ($language == 'zh-hk') {
            return [
                'type.required' => '操作不能为空',
                'type.in' => '操作只能为:1,2',
                'black_uid.required' => '用户ID不能为空',
            ];
        } else {
            return [
                'type.required' => 'type can not be empty',
                'type.in' => 'type can only be:1,2',
                'black_uid.required' => 'black_uid can not be empty',
            ];
        }
    }

}
